using System;
using System.Collections.Generic;
using System.Linq;
using Godot;

public class Ma : IEntity
{
    public List<Vector2I> GetNextPos(Game game, int team, Vector2I current)
    {
        var ans = new List<Vector2I>();
        foreach (var relFirst in Rule.DIRECTLY_MOVEMENT)
        {
            var middle = current + relFirst;
            if (Rule.OnBoard(middle) && game.entitySlot[middle.X, middle.Y] == null)
            {
                foreach (var relNext in Rule.DIAGONAL_MOVEMENT.Where(n => (relFirst.X != 0 && n.X == relFirst.X) || (relFirst.Y != 0 && n.Y == relFirst.Y)))
                {
                    var next = middle + relNext;
                    if (Rule.OnBoard(next) && game.entitySlot[next.X, next.Y]?.team != team)
                    {
                        ans.Add(next);
                    }
                }
            }
        }

        return ans;
    }
}